from logger import logger
from sub_events.base_event import BaseEvent

LOGGER = logger.CustomLogger()

class SummonDragonEvent(BaseEvent):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.event_name_zh: str = "召唤神龙"
        self.event_name_en: str = "Summon Dragon"

    def execute(self) :
        """
        当白名单使用召唤神龙时，会出现一个管理员给你加分。
        """
        self.comment = """```json
                        y   y                                 
                          @                                   
                      .  @=+-                                 
                    @*@@                                      
                      :* .--:.                                
                 -#%=. . :--=                                 
              #@*%# -+.. . .=-                                
                =:        .:=-:                               
                         ==+-               .-:  ::           
                   . .:**#-            .=*==-:-=+==+-=-       
                 : .:*#-           -=-#:-:.:. .  .:-=:#===.   
                . .-+:           :--=..-    .-.:      :.-.:   
        -@@@    . -.=          =*.=.-... .#*=.=+-+-    .:-+.  
           @      -:-:    :==#+:+ :          :   =:.      :-= 
           @=*%+.  * -==++=-=.:...      ::*%+-  -        .::- 
                .:   .. -:.::.         =:#-    *@+.       .-+ 
                     +*#+:.                  @*@@         +:- 
              -@@@@@.                        @+@         =*:  
               .@                                       +=:   
                                                     -#+:     
                                                    *                
```

Dragon has been summoned. Awwwww!!!
"""
        if self.hook.commenter not in self.cfg.get("sub_events", {}).get("summon_dragon", {}).get("whitelist_accounts"):
            return

        response = self.git_client.review(self.hook.pr_number, token=self.get_admin_token())
        LOGGER.info(f"[{self.hook.pr_number}] {self.hook.commenter} summon dragon and sunfei reviewed, response code {response.status_code}")
